<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<title>交易限制</title>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<!-- 当前页面样式 -->
<link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
<!-- 当前页面样式 END -->
<style type="text/css">
.blue{
	color: blue
}
</style>
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type="text/javascript">
$(document).ready(function(){
		$('#sub').click(function(){
			$("#queryForm").attr("action","<%=basePath%>/translimit/limitList.ct");
			$("#queryForm").submit();
			$(this).attr("disabled","true");
		});
		$('#addRule').click(function(){
			$("#queryForm").attr("action","<%=basePath%>/translimit/addRuleJsp.ct");
			$("#queryForm").submit();
		});
		$('#exportWhitelist').click(function(){
			$("#queryForm").attr("action","<%=basePath%>/whitelist/startExportJsp.ct");
			$("#queryForm").submit();
		});
	});	

	function updateRiskRule(incd,mchtId,termCd,transType,riskInfo,riskCycle,riskKey,riskMethod,unite)
	{	
		transType=encodeURI(transType).replace(/\+/g,'%2B');
		var params="bean.inCd="+incd+"&bean.mchtCd="+mchtId+"&bean.termCd="+termCd+"&bean.transType="+transType
		+"&bean.riskInfo="+riskInfo+"&bean.riskCycle="+riskCycle+"&bean.riskKey="+riskKey+"&bean.riskMethod="+riskMethod
		+"&bean.unite="+unite;
		$("#queryForm").attr("action","<%=basePath%>/translimit/updateRuleJsp.ct?"+params);
		$("#queryForm").submit();
	}
</script>
</head>

<body>
		<s:form id="queryForm" action="/translimit/limitList.ct" method="post"
			theme="simple">
			<table class="tb">
				<tbody>
				<tr class="tb-line">
            		<td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div><font color="red">提示：*表示通用</font></td>
        		</tr>
				 <tr class="tb-line">
					<td class="tb-td" colspan="6">
						<div class="tb-h3">交易限制</div>
					</td>
				</tr>

				 <tr class="tb-line">
				 	<td width="12%" style="min-width: 150px" align="right" class="tb-td">
				 	 <div class="tb-h4" id="blackNum">商户号：</div>
				 	 </td>
					<td class="tb-td">
                		<label class="tb-input-normal">
						<s:textfield  name="searchCondition.mchtCd" cssClass="queryWidth" />
							</label>
							</td>
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                	<div class="tb-h4">终端号：</div>
            		</td>
					<td class="tb-td">
                		<label class="tb-input-normal">
						<s:textfield  name="searchCondition.termId" cssClass="queryWidth" />
							</label>
					</td>
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                	<div class="tb-h4">所属机构：</div>
            		</td>
					<td class="tb-td">
                	<label class="tb-select">
                		<s:select cssClass="queryWidth" name="searchCondition.orgCode" id="orgCode"
							list="#request.orgList" listKey="insIdCd" listValue="insName" /> 
					</label>
					</td>
				</tr>
				 <tr class="tb-line">
				 	<td width="12%" style="min-width: 150px" align="right" class="tb-td">
				 	 <div class="tb-h4" id="blackNum">交易类型：</div>
				 	 </td>
					<td class="tb-td">
                	<label class="tb-select">
						<s:select name="searchCondition.transType" list="#{'POS_D0':'D0','POS_T1':'T1','POS_T1+D0':'T1+D0'}" headerKey="" headerValue="不限" cssClass="queryWidth" /> 
					</label>
					</td>
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                	<div class="tb-h4">风控对象：</div>
            		</td>
					<td class="tb-td">
                	<label class="tb-select">
						<s:select name="searchCondition.riskInfo" list="#{'Mcht':'商户','Card':'银行卡'}" headerKey="" headerValue="不限" cssClass="queryWidth" /> 
					</label>
					</td>
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                	<div class="tb-h4">特使类型：</div>
            		</td>
					<td class="tb-td">
                	<label class="tb-select">
						<s:select name="searchCondition.cardType" list="#{'CT':'磁条卡','IC':'芯片卡','Credit':'贷记卡','Debit':'借记卡','Normal':'通用','Min':'最小值','Max':'最大值','Mcht':'单商户'}" headerKey="" headerValue="不限" cssClass="queryWidth" /> 
					</label>
					</td>
				</tr>
				<tr class="tb-line">
				 	<td width="12%" style="min-width: 150px" align="right" class="tb-td">
				 	 <div class="tb-h4" id="blackNum">状态：</div>
				 	 </td>
					<td class="tb-td">
                	<label class="tb-select">
						<s:select name="searchCondition.flag" list="#{'0':'关闭','1':'开启'}" headerKey="" headerValue="不限" cssClass="queryWidth" /> 
					</label>
					</td>
				</tr>
				<tr>
						<td colspan="6" align="center"><span style="color: red"><s:actionerror /></span>
							<span style="color: red;"><s:actionmessage /></span > <span style="color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
				 <tr class="tb-line">
           		 <td class="tb-td line-submit" align="right" colspan="6">
                <label class="tb-input-submit"><input type="button" value="查询" id="sub"/></label>
				<label class="tb-input-submit"><s:reset value="取 消" /></label> 
				<label class="tb-input-submit"><input type="button" value="添加" id="addRule"/></label>
				<!-- <label class="tb-input-submit"><input type="button" value="批量导入" id="exportWhitelist"/></label>	  -->
				</td>
				</tr>
				
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="6"><page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/translimit/limitList.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table>
			
				
	<div class="big-tb">
    <table class="tb" style="width: 100%;">
				<thead>
            	<tr class="tb-line">
                <th class="tb-th" colspan="12"><div class="tb-h3">风控规则列表</div></th>
            	</tr>
					 <tr class="tb-line bg-gray">
						<th class="tb-th" id="title">机构号</th>	
						<th class="tb-th">商户号</th>
						<th class="tb-th">终端号</th>				
						<th class="tb-th">交易类型</th>
						<th class="tb-th">风控对象</th>
						<th class="tb-th">风控周期</th>
						<th class="tb-th">特使类型</th>
						<th class="tb-th">计算方法</th>
						<th class="tb-th">单位类型</th>
						<th class="tb-th">数值</th>
						<th class="tb-th">状态</th>
						<th class="tb-th">操作</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="bean">
							<tr class="tb-line" >
							<td class="tb-td" align="center">
							<s:property value="#bean.inCd"/>
							</td>
							<td class="tb-td" align="center">
							<s:property value="#bean.mchtCd"/>						
							</td>
							<td class="tb-td" align="center">
							<s:property value="#bean.termCd"/>
							</td>
							<td class="tb-td" align="center"><s:property value="#bean.transType"/></td>
							<td class="tb-td" align="center">
							<s:if test="#bean.riskInfo==\"Mcht\"">
								商户
							</s:if>
							<s:elseif test="#bean.riskInfo==\"Card\"">
								银行卡
							</s:elseif>
							</td>
							<td class="tb-td" align="center">
							<s:if test="#bean.riskCycle==\"Normal\"">
								通用
							</s:if>
							<s:elseif test="#bean.riskCycle==\"Month\"">
								单月
							</s:elseif>
							<s:elseif test="#bean.riskCycle==\"Day\"">
								单日
							</s:elseif>
							<s:elseif test="#bean.riskCycle==\"CT\"">
								磁条卡
							</s:elseif>
							<s:elseif test="#bean.riskCycle==\"IC\"">
								芯片卡
							</s:elseif>
							<s:elseif test="#bean.riskCycle==\"Credit\"">
								贷记卡
							</s:elseif>
							<s:elseif test="#bean.riskCycle==\"Debit\"">
								借记卡
							</s:elseif>							
							</td>
							<td class="tb-td" align="center">
							<s:if test="#bean.riskKey==\"CT\"">
								磁条卡
							</s:if>
							<s:elseif test="#bean.riskKey==\"IC\"">
								芯片卡
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Credit\"">
								贷记卡
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Debit\"">
								借记卡
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Normal\"">
								通用
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Min\"">
								最小值
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Max\"">
								最大值
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Passwod\"">
								密码错误
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Mcht\"">
								单商户
							</s:elseif>
							<s:elseif test="#bean.riskKey==\"Banlance\"">
								Banlance
							</s:elseif>
							</td>
							<td class="tb-td" align="center">
							<s:if test="#bean.riskMethod==\"Total\"">
								累计
							</s:if>
							<s:elseif test="#bean.riskMethod==\"Single\"">
								单笔
							</s:elseif>
							</td>
							<td class="tb-td" align="center">
							<s:if test="#bean.unite==\"Money\"">
								金额
							</s:if>
							<s:elseif test="#bean.unite==\"Count\"">
								次数
							</s:elseif>
							<s:elseif test="#bean.unite==\"Time\"">
								间隔时间(s)
							</s:elseif>
							</td>
							<td class="tb-td"><s:property value="#bean.valueMax"/></td>
							<td class="tb-td" align="center">
							<s:if test="#bean.status==0">关闭</s:if>
							<s:elseif test="#bean.status==1">开启</s:elseif>
							</td>
							<td align="center">
							<a href="javascript:void(0)" onclick="updateRiskRule('<s:property value="#bean.inCd"/>',
							'<s:property value="#bean.mchtCd"/>','<s:property value="#bean.termCd"/>','<s:property value="#bean.transType"/>',
							'<s:property value="#bean.riskInfo"/>','<s:property value="#bean.riskCycle"/>','<s:property value="#bean.riskKey"/>',
							'<s:property value="#bean.riskMethod"/>','<s:property value="#bean.unite"/>')" class="blue">修改</a>
							</td>
						</s:iterator>
				</tbody>
			</table>
			</div>
		</s:form>
	<s:if test="#request.info_request !=null">
	<script language="javascript">
	    alert("${request.info_request}");
	    </script>
	</s:if>	
</body>
</html>
